package com.gzk.oeno.business.compare;

import java.util.Comparator;

import com.gzk.oeno.business.cepage.Cepage;
import com.gzk.oeno.tech.set.IdPair;

public class CompoPortionComparator implements Comparator<IdPair<Cepage, Float>>{

	@Override
	public int compare(IdPair<Cepage, Float> o1, IdPair<Cepage, Float> o2) {
		if (o1 == null && o2 == null)
			return 0;
		if (o1 == null)
			return 1;
		if (o2 == null)
			return -1;
		if (o1.getSecond() == null && o2.getSecond() == null)
			return 0;
		if (o1.getSecond() == null)
			return 1;
		if (o2.getSecond() == null)
			return -1; 
		return o2.getSecond().compareTo(o1.getSecond());
	}

}
